<?php

namespace App\Http\Controllers\User;

use App\Models\User;
use App\Jobs\UploadImage;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class UserController extends Controller
{
    public function edit()
    {
        return view('users.edit');
    }

    public function store(Request $request)
    {
        $user = User::find(auth()->id());
        if ($request->file('avtar')) {
            $request->file('avtar')->move(storage_path().'/uploads', $fileId = uniqid(true));
            //执行队列
            $this->dispatch(new UploadImage($user, $fileId));
            return back();
        }
    }
}
